import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;


public class Test12 {
	public static void main(String[] args) {
		
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Test12 a = new Test12();
		System.out.println(formatter.format(a.getGmtDate()));
	}

	public void offset() {
		Calendar myCalendar = new GregorianCalendar();

		int gmtOffset = myCalendar.get(Calendar.ZONE_OFFSET);
		System.out.println("GMT Offset is " + gmtOffset + " milliseonds (or "
				+ TimeUnit.HOURS.convert(gmtOffset, TimeUnit.MILLISECONDS) + " hours)");

		Calendar myCalendar2 = new GregorianCalendar();
		TimeZone timeZone = myCalendar2.getTimeZone();
		int gmtOffset2 = timeZone.getRawOffset();
		System.out.println("GMT Offset is " + gmtOffset2 + " milliseonds (or "
				+ TimeUnit.HOURS.convert(gmtOffset2, TimeUnit.MILLISECONDS) + " hours)");
	}
	private Date getGmtDate() {
		Calendar calendar = Calendar.getInstance();
		int offset = calendar.get(Calendar.ZONE_OFFSET) / 3600000
				+ calendar.get(Calendar.DST_OFFSET) / 3600000;
		calendar.add(Calendar.HOUR, -offset);
		Date date = calendar.getTime();

		return date;
	}
}